#include <iostream>
#include <unordered_map>

using namespace std;

class Solution {
private:
    int days;
    bool is_run;
    void count_year(int year) {
        for (int year_count = 1971; year_count < year; year_count++) {
            if (year_count % 100 == 0) {
                if (year_count % 400 == 0) {
                    days += 366;
                } else {
                    days += 365;
                }
            } else if (year_count % 4 == 0) {
                days += 366;
            } else {
                days += 365;
            }
        }
    }
    void count_month(int year, int month) {
        for (int month_count = 1; month_count < month; month_count++) {
            switch (month_count) {
                case 1:
                    days += 31;
                    break;
                case 2:
                    if (year % 100 == 0) {
                        if (year % 400 == 0) {
                            days += 29;
                        } else {
                            days += 28;
                        }
                    } else if (year % 4 == 0) {
                        days += 29;
                    } else {
                        days += 28;
                    }
                    break;
                case 3:
                    days += 31;
                    break;
                case 4:
                    days += 30;
                    break;
                case 5:
                    days += 31;
                    break;
                case 6:
                    days += 30;
                    break;
                case 7:
                    days += 31;
                    break;
                case 8:
                    days += 31;
                    break;
                case 9:
                    days += 30;
                    break;
                case 10:
                    days += 31;
                    break;
                case 11:
                    days += 30;
                    break;
                case 12:
                    days += 31;
                    break;
                default:
                    break;
            }
        }
    }
    void count_day(int day) {
        days += day - 1;
    }
public:
    string dayOfTheWeek(int day, int month, int year) {
        days = 0;
        count_year(year);
        count_month(year, month);
        count_day(day);
        int week = days % 7;
        switch (week) {
            case 0:
                return "Friday";
            case 1:
                return "Saturday";
            case 2:
                return "Sunday";
            case 3:
                return "Monday";
            case 4:
                return "Tuesday";
            case 5:
                return "Wednesday";
            case 6:
                return "Thursday";
        }
        return "";
    }
};

int main() {
    Solution solution;
    string output = solution.dayOfTheWeek(21, 12, 1980);
    cout << output << endl;
}